//异常定义
#ifndef __EXCEPTIONDEFINITION__HPP
#define __EXCEPTIONDEFINITION__HPP

#include<iostream>
using namespace std;

namespace NgSiuKei {

enum Exception {
    EXCEPTION_OUT_OF_BOUNDS,    //越界
    EXCEPTION_IS_EMPTY,         //容器空
    EXCEPTION_IS_FULL,          //容器满
    EXCEPTION_CAN_NOT_FIND,     //找不到数据
    EXCEPTION_NULL_POINTER,     //使用了空指针
};

void printException(Exception exception) {
    cout << "异常：";
    switch(exception) {
        case EXCEPTION_OUT_OF_BOUNDS: { //越界
            cout << "发生了越界" << endl;
            break;
        }
        case EXCEPTION_IS_EMPTY: {
            cout << "容器是空的" << endl;
            break;
        }
        case EXCEPTION_IS_FULL: {
            cout << "容器是满的" << endl;
            break;
        }
        case EXCEPTION_CAN_NOT_FIND: {
            cout << "找不到目标数据" << endl;
            break;
        }
        case EXCEPTION_NULL_POINTER: {
            cout << "使用了空指针" << endl;
            break;
        }
        default: {
            cout << "未知错误" << endl;
            break;
        }
    }
}

}

#endif